home *** CD-ROM | disk | FTP | other *** search
/ Network CD 2 / Network CD - Volume 2.iso / programs / internet / tcp / amitcp / amitcp-api-22.lha / AmiTCP-2.2 / netinclude / sys / ioctl.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-12  |  7.4 KB  |  170 lines

  1. /*
  2.  * $Id: ioctl.h,v 1.12 1993/07/21 08:01:13 jraja Exp $
  3.  *
  4.  * Copyright (c) 1993 AmiTCP/IP Group, <amitcp-group@hut.fi>
  5.  *                    Helsinki University of Technology, Finland.
  6.  *                    All rights reserved.
  7.  *
  8.  * HISTORY
  9.  * $Log: ioctl.h,v $
  10.  * Revision 1.12  1993/07/21  08:01:13  jraja
  11.  * Changed 'int' type ioctl arguments to 'long' to be able to work with
  12.  * 16 bit integers.
  13.  *
  14.  * Revision 1.11  1993/07/11  15:28:38  ppessi
  15.  * Changed interface ioctl codes
  16.  *
  17.  * Revision 1.10  1993/06/04  11:16:15  jraja
  18.  * Fixes for first public release.
  19.  *
  20.  * Revision 1.9  1993/06/02  18:23:25  jraja
  21.  * Removed SIOC[SG](HI|LO)WAT, since they are not implemented.
  22.  *
  23.  * Revision 1.8  1993/05/17  01:02:04  ppessi
  24.  * Changed RCS version
  25.  *
  26.  * Revision 1.7  1993/05/15  00:49:11  ppessi
  27.  * Added ioctl for interfaces and arp
  28.  *
  29.  * Revision 1.6  93/03/03  19:49:14  19:49:14  jraja (Jarno Tapio Rajahalme)
  30.  * Cleanup. Changed _IOCTL_H_ to SYS_IOCTL_H.
  31.  * 
  32.  * Revision 1.5  93/02/25  16:50:08  16:50:08  too (Tomi Ollila)
  33.  * previous history message removed since it had comment end stream.
  34.  * 
  35.  * 
  36.  * Revision 1.3  93/02/23  17:57:23  17:57:23  too (Tomi Ollila)
  37.  * Hided prototype of ioctl() when AMITCP defined
  38.  * 
  39.  * Revision 1.2  92/11/20  15:56:32  15:56:32  jraja (Jarno Tapio Rajahalme)
  40.  * Added #ifndef AMITCP's to make this compile.
  41.  * 
  42.  * Revision 1.1  92/11/20  15:47:42  15:47:42  jraja (Jarno Tapio Rajahalme)
  43.  * Initial revision
  44.  */
  45.  
  46. /*-
  47.  * Copyright (c) 1982, 1986, 1990 The Regents of the University of California.
  48.  * All rights reserved.
  49.  *
  50.  * Redistribution and use in source and binary forms, with or without
  51.  * modification, are permitted provided that the following conditions
  52.  * are met:
  53.  * 1. Redistributions of source code must retain the above copyright
  54.  *    notice, this list of conditions and the following disclaimer.
  55.  * 2. Redistributions in binary form must reproduce the above copyright
  56.  *    notice, this list of conditions and the following disclaimer in the
  57.  *    documentation and/or other materials provided with the distribution.
  58.  * 3. All advertising materials mentioning features or use of this software
  59.  *    must display the following acknowledgement:
  60.  *    This product includes software developed by the University of
  61.  *    California, Berkeley and its contributors.
  62.  * 4. Neither the name of the University nor the names of its contributors
  63.  *    may be used to endorse or promote products derived from this software
  64.  *    without specific prior written permission.
  65.  *
  66.  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  67.  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  68.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  69.  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  70.  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  71.  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  72.  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  73.  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  74.  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  75.  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  76.  * SUCH DAMAGE.
  77.  *
  78.  *    @(#)ioctl.h    7.19 (Berkeley) 6/26/91
  79.  */
  80.  
  81. #ifndef    SYS_IOCTL_H
  82. #define    SYS_IOCTL_H
  83.  
  84. /*
  85.  * Ioctl's have the command encoded in the lower word, and the size of
  86.  * any in or out parameters in the upper word.  The high 3 bits of the
  87.  * upper word are used to encode the in/out status of the parameter.
  88.  */
  89.  
  90. #define    IOCPARM_MASK    0x1fff        /* parameter length, at most 13 bits */
  91. #define    IOCPARM_LEN(x)    (((x) >> 16) & IOCPARM_MASK)
  92. #define    IOCBASECMD(x)    ((x) & ~IOCPARM_MASK)
  93. #define    IOCGROUP(x)    (((x) >> 8) & 0xff)
  94.  
  95. #define    IOCPARM_MAX    4096        /* max size of ioctl */
  96. #define    IOC_VOID    0x20000000    /* no parameters */
  97. #define    IOC_OUT        0x40000000    /* copy out parameters */
  98. #define    IOC_IN        0x80000000    /* copy in parameters */
  99. #define    IOC_INOUT    (IOC_IN|IOC_OUT)
  100. #define    IOC_DIRMASK    0xe0000000    /* mask for IN/OUT/VOID */
  101.  
  102. #define _IOC(inout,group,num,len) \
  103.     (inout | ((len & IOCPARM_MASK) << 16) | ((group) << 8) | (num))
  104. #define    _IO(g,n)    _IOC(IOC_VOID,    (g), (n), 0)
  105. #define    _IOR(g,n,t)    _IOC(IOC_OUT,    (g), (n), sizeof(t))
  106. #define    _IOW(g,n,t)    _IOC(IOC_IN,    (g), (n), sizeof(t))
  107. /* this should be _IORW, but stdio got there first */
  108. #define    _IOWR(g,n,t)    _IOC(IOC_INOUT,    (g), (n), sizeof(t))
  109.  
  110. /* 
  111.  * file i/o controls
  112.  */
  113. #define    FIOCLEX        _IO('f', 1)           /* set close on exec on fd */
  114. #define    FIONCLEX    _IO('f', 2)           /* remove close on exec */
  115. #define    FIONREAD    _IOR('f', 127, long)   /* get # bytes to read */
  116. #define    FIONBIO        _IOW('f', 126, long)   /* set/clear non-blocking i/o */
  117. #define    FIOASYNC    _IOW('f', 125, long)   /* set/clear async i/o */
  118. #define    FIOSETOWN    _IOW('f', 124, long)   /* set owner (struct Task *) */
  119. #define    FIOGETOWN    _IOR('f', 123, long)   /* get owner (struct Task *) */
  120.  
  121. /* 
  122.  * socket i/o controls
  123.  *
  124.  * SIOCSPGRP and SIOCGPGRP are identical to the FIOSETOWN and FIOGETOWN,
  125.  * respectively.
  126.  */
  127. #define    SIOCATMARK    _IOR('s',  7, long)    /* at oob mark? */
  128. #define    SIOCSPGRP    _IOW('s',  8, long)    /* set process group */
  129. #define    SIOCGPGRP    _IOR('s',  9, long)    /* get process group */
  130.  
  131. #define    SIOCADDRT    _IOW('r', 10, struct ortentry) /* add route */
  132. #define    SIOCDELRT    _IOW('r', 11, struct ortentry) /* delete route */
  133.  
  134. #define    SIOCSIFADDR    _IOW('I', 12, struct ifreq)    /* set ifnet address */
  135. #define    OSIOCGIFADDR    _IOWR('I',13, struct ifreq)    /* get ifnet address */
  136. #define    SIOCGIFADDR    _IOWR('I',33, struct ifreq)    /* get ifnet address */
  137. #define    SIOCSIFDSTADDR    _IOW('I', 14, struct ifreq)    /* set p-p address */
  138. #define    OSIOCGIFDSTADDR    _IOWR('I',15, struct ifreq)    /* get p-p address */
  139. #define    SIOCGIFDSTADDR    _IOWR('I',34, struct ifreq)    /* get p-p address */
  140. #define    SIOCSIFFLAGS    _IOW('I', 16, struct ifreq)    /* set ifnet flags */
  141. #define    SIOCGIFFLAGS    _IOWR('I',17, struct ifreq)    /* get ifnet flags */
  142. #define    OSIOCGIFBRDADDR    _IOWR('I',18, struct ifreq)    /* get broadcast addr */
  143. #define    SIOCGIFBRDADDR    _IOWR('I',35, struct ifreq)    /* get broadcast addr */
  144. #define    SIOCSIFBRDADDR    _IOW('I',19, struct ifreq)     /* set broadcast addr */
  145. #define    OSIOCGIFCONF    _IOWR('I',20, struct ifconf)   /* get ifnet list */
  146. #define    SIOCGIFCONF    _IOWR('I',36, struct ifconf)   /* get ifnet list */
  147. #define    OSIOCGIFNETMASK    _IOWR('I',21, struct ifreq)    /* get net addr mask */
  148. #define    SIOCGIFNETMASK    _IOWR('I',37, struct ifreq)    /* get net addr mask */
  149. #define    SIOCSIFNETMASK    _IOW('I',22, struct ifreq)     /* set net addr mask */
  150. #define    SIOCGIFMETRIC    _IOWR('I',23, struct ifreq)    /* get IF metric */
  151. #define    SIOCSIFMETRIC    _IOW('I',24, struct ifreq)     /* set IF metric */
  152. #define    SIOCDIFADDR    _IOW('I',25, struct ifreq)     /* delete IF addr */
  153. #define    SIOCAIFADDR    _IOW('I',26, struct ifaliasreq)    /* add/chg IF alias */
  154.  
  155.  
  156. #define    SIOCSARP    _IOW('I', 30, struct arpreq)   /* set arp entry */
  157. #define    OSIOCGARP    _IOWR('I',31, struct arpreq)   /* get arp entry */
  158. #define    SIOCGARP    _IOWR('I',38, struct arpreq)   /* get arp entry */
  159. #define    SIOCDARP    _IOW('I', 32, struct arpreq)   /* delete arp entry */
  160.  
  161. /*
  162.  * A private extension to the BSD44 ioctl interface
  163.  */
  164. #define SIOCSSANATAGS   _IOW('I',64, struct wiretype_parameters) 
  165. #define SIOCGSANATAGS   _IOR('I',65, struct wiretype_parameters)
  166. /* Get arp table addr */
  167. #define SIOCGARPT       _IOWR('I',66, struct arptabreq)   
  168.  
  169. #endif /* !SYS_IOCTL_H */
  170.